﻿using Core.Domain.Entities;
using Core.Migrations.Extensions;
using FluentMigrator;

namespace Infrastructure.Persistence.Migrations.RolePermissions;

[Migration(202510232232)]
public class CreateColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(typeof(RolePermission).GetTableName())
          .InSchema(SchemaNames.Identity)
          .AddColumn("TenantId").AsString(100).Nullable().WithColumnDescription("租户标识")
          .AddColumn(MigrationExpressions.ColumnNameFor<RolePermission>(nameof(RolePermission.PermissionId))).AsGuid().Nullable().WithColumnDescription("权限ID")
          .AddColumn(MigrationExpressions.ColumnNameFor<RolePermission>(nameof(RolePermission.RoleId))).AsGuid().Nullable().WithColumnDescription("角色ID")
          .AddColumn(MigrationExpressions.ColumnNameFor<RolePermission>(nameof(RolePermission.AccessState))).AsString(100).Nullable().WithColumnDescription("访问状态"); ;
    }
}
